package net.janhoo.toolshed.basic;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.util.Calendar;
import java.util.Date;

public class DateTimeCalc {
	
	public static final int SECONDS_PER_HOUR = 3600;
	public static final int SECONDS_PER_MINUTE = 60;
	public static final int MINUTES_PER_HOUR = 60;

	private static final DecimalFormat FORMAT_LEADINGZERO = new DecimalFormat("00");
	
	private Date date = null;
	
	
	public DateTimeCalc() {
		super();
	}
	
	public DateTimeCalc(String offset) {
		Date now = new Date(System.currentTimeMillis());
		
	}
	
	
	
	public static String printDuration(int seconds) {
		int hours = seconds / SECONDS_PER_HOUR;
		seconds = seconds % SECONDS_PER_HOUR;
		int minutes = seconds / SECONDS_PER_MINUTE;
		seconds = seconds % SECONDS_PER_MINUTE;
		
		return FORMAT_LEADINGZERO.format(hours) + ":" + FORMAT_LEADINGZERO.format(minutes) + ":" + FORMAT_LEADINGZERO.format(seconds);
	}
	
	public static int calcDuration(String print) {
		
		String[] parts = print.split(":",3);
		
		
		return Integer.valueOf(parts[0]) * SECONDS_PER_HOUR + Integer.valueOf(parts[1]) * SECONDS_PER_MINUTE + Integer.valueOf(parts[2]);
	}
	
	
	
}
